package wawi.actions;

import java.util.ArrayList;
import java.util.List;

import wawi.db.DbConnector;
import wawi.util.Laden;

import com.opensymphony.xwork2.ActionSupport;

public class GutschriftListe extends ActionSupport
{
	private ArrayList<ArrayList<String>> aaData = new ArrayList<ArrayList<String>>();

	public ArrayList<ArrayList<String>> getAaData() {
		return aaData;
	}

	public void setAaData(ArrayList<ArrayList<String>> aaData) {
		this.aaData = aaData;
	}
	
	public String execute()
	{
		List<Gutschrift> list = DbConnector.getInstance().getGutschriftList();
		
		for (Gutschrift tmp : list)
		{
			ArrayList<String> row = new ArrayList<String>();
			row.add(tmp.getGuNum());
			row.add(tmp.getGuDatum());
			row.add(Laden.getName(tmp.getLaden()));
			row.add(tmp.getStatusString());
			row.add(tmp.getBetrag() + " EUR");
//			row.add(String.format("<a href=\"Verkauf_anzeige.action?recid=%d\">Details</a>", tmp.getRecid()));
			
			aaData.add(row);
		}
		
		return ActionSupport.SUCCESS;
	}
	
	
}
